email me at borlaj@portlandschools.org

Loading
notes previous (12/<12) submit the dump links  
 

HWJ17 - Read/Write Files

 

Class Assignment:

  1. Create an app called PhoneList (like this but with memory) that will have the user put in names (textfield) and phone number (textfield), with a button for add to phone list. It will also have a phone list with all names-phone nums in the system.
    • Look at textarea for info
    • Everytime you add a new number and phone add it to your file maybe call m.addLine(addressString+"-"+phoneString);
  2. Create an app called RunningTracker that will track how many miles that users has run. It will have a textfield where they will enter the number of miles they ran that day. It will have another textfield that will say they have run a total of ___ miles. Remember Integer.parseInt(str) will convert str (a string) to an int.
    • Hints, get milesToday and convert to int like above
    • get milesTotal and convert to int
    • add those ints together and save as TOTAL
    • put total into milesTotalField
    • save total in the file (using replaceFile)
    • Under init when the program starts, read file and put that value in milesTotalField
  3. Create a console application (with system.out) that will print out that contents of this file. (download it and put it in your directory)

Advanced

  1. Create an app called TriathlonTracker where the user will have an combobox option of Run, Swim, Bike and the number of minutes down with each exercise. When they hit submit, it will add to the file. It will say somewhere the total number of minutes done with each exercise and their average. Like swimming 6.7 hours, averaging 25 minutes a workout. See here for combobox.
  2. Really advanced, put phonelist above in to a table, not textarea. See here for table.